package com.klikmee.sms.core.base;

import java.text.MessageFormat;

import org.apache.log4j.Logger;

import com.klikmee.sms.core.base.communicator.DeliveryReport;
import com.klikmee.sms.core.model.BulkMessage;

/**
 * Delivery report filter for {@link BulkMessage} delivery reports
 * 
 * @author makcro
 * 
 */
public class BulkDeliveryReportFilterImpl extends DeliveryReportFilterBase<BulkMessage> {

	/**
	 * Logger instance
	 */
	private Logger	logger	= Logger.getLogger( BulkDeliveryReportFilterImpl.class );

	@Override
	protected void postReportToService(BulkMessage sentMessage) {
		this.serviceMessageDeliverer.forwardDeliveryReport( sentMessage );
	}

	@Override
	protected void updateStatus(DeliveryReport deliveryReport, BulkMessage sentMessage) {
		sentMessage.setDeliveryStatus( deliveryReport.getStatus() );
		logger.debug( MessageFormat.format( "Updateed status of BulkMessage[{0}] to [{1}]", sentMessage.getId(), sentMessage.getDeliveryStatus() ) );
	}

}
